<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.util.Map"%>
<%@page import="java.util.HashMap"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@ taglib prefix="f" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="/admin/res/style.css">
<link rel="stylesheet" type="text/css" href="/admin/res/index.css">
<script src="/admin/res/jquery.min.js"></script>
<script src="/admin/res/cookie.js"></script>
<script src="/admin/res/layindex.js"></script>
<script type="text/javascript" src="/skin/scripts/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="/editor/kindeditor-min.js"></script>
<script type="text/javascript" charset="utf-8" src="/editor/lang/zh_CN.js"></script>
 <script src="/skin/icheck/icheck.min.js"></script>
 
 <link href="/skin/scripts/codemirror/lib/codemirror.css" rel="stylesheet" type="text/css">
<link href="/skin/scripts/codemirror/theme/monokai.css" rel="stylesheet" type="text/css">
<link href="/skin/scripts/codemirror/addon/display/fullscreen.css" rel="stylesheet" type="text/css">
<link href="/skin/scripts/codemirror/addon/scroll/simplescrollbars.css" type="text/css"  />
<script type="text/javascript" src="/skin/scripts/codemirror/lib/codemirror.js"></script>
<!-- CodeMirror支持不同语言，根据需要引入JS文件 -->
<!-- 因为HTML混合语言依赖Javascript、XML、CSS语言支持，所以都要引入 -->
<script type="text/javascript" src="/skin/scripts/codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/mode/xml/xml.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/mode/css/css.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<!-- 下面分别为显示行数、括号匹配和全屏插件 -->
<script type="text/javascript" src="/skin/scripts/codemirror/addon/selection/active-line.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/addon/edit/matchbrackets.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/addon/display/fullscreen.js"></script>
<script type="text/javascript" src="/skin/scripts/codemirror/addon/scroll/simplescrollbars.js"></script>
 <script type="text/javascript">
     $(function () {
    	 $('input').iCheck({
 		    checkboxClass: 'icheckbox_square-blue',
 		    radioClass: 'iradio_square-blue',
 		    increaseArea: '20%' 
 		  });
            
      
        });
   
     
</script>

</head>
<body class="mainbody">


<f:form action="/cms/tpl/add" method="POST" modelAttribute="tpl">
		<c:if test="${node.id!=null }">
			<f:hidden path="id" />			
			<input type="hidden" name="_method" value="PUT" />
		</c:if>
<div class="row">
    <div class="form-group col-md-6">
    <label>模板名称</label>
    <div class="controls">
    <f:input path="title" class="form-control"  /> 
    </div>
  </div>
  <div class="form-group col-md-6">
    <label>模板类型</label>
    <div class="controls">
     <f:select path="filetype" class="form-control">
     <f:option value="1">首页模板</f:option>
     <f:option value="2">栏目模板</f:option>
     <f:option value="3">内容模板</f:option>
     <f:option value="4">单页模板</f:option>
     <f:option value="5">包含文件</f:option>
     </f:select>
    </div>
  </div>
  
  </div>
  <div class="row">
<div class="form-group col-md-6">
    <label>文件名称</label>
   <div class="input-group">
          <f:input path="fileaddr" class="form-control" />
          <div class="input-group-addon">.tpl</div>
        </div>
  </div>
         <div class="form-group col-md-6">
    <label>默认模板</label>
    <div class="controls">   
  <f:checkbox path="isdefault" /><label>是</label> 
    </div>    
  </div>
  </div>
  
  <div class="form-group">  
  光标在编辑器按F11可切换全屏幕编辑，ESC键可退出全屏编辑。<br />
<f:textarea path="txtnr" class="editor" /></textarea>
  </div>
  
   
  
  <button type="submit" class="btn btn-primary">提交保存</button>
</f:form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("txtnr"), {
    lineNumbers: true,     // 显示行数
    indentUnit: 4,         // 缩进单位为4
    styleActiveLine: true, // 当前行背景高亮
    matchBrackets: true,   // 括号匹配
    mode: 'htmlmixed',     // HMTL混合模式
    lineWrapping: true,    // 自动换行
    theme: 'monokai',      // 使用monokai模版
});
  editor.setOption("extraKeys", {
      // Tab键换成4个空格
      Tab: function(cm) {
          var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
          cm.replaceSelection(spaces);
      },
      // F11键切换全屏
      "F11": function(cm) {
          cm.setOption("fullScreen", !cm.getOption("fullScreen"));
      },
      // Esc键退出全屏
      "Esc": function(cm) {
          if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
      }
  });
</script>
</body>
</html>